//package main
//
//import (
//	"net/http"
//)
//
//func main() {
//	http.Handle("/", http.FileServer(http.Dir("./")))
//	http.ListenAndServe(":9200", nil)
//}
//
//





package main

import (
	"html/template"
	"net/http"
)

//Compile templates on start
var templates = template.Must(template.ParseFiles("html\\header.html", "html\\footer.html", "html\\main.html", "html\\about.html"))

//A Page structure
type Page struct {
	Title string
}

//Display the named template
func display(w http.ResponseWriter, tmpl string, data interface{}) {
	templates.ExecuteTemplate(w, tmpl, data)
}

//The handlers.
func mainHandler(w http.ResponseWriter, r *http.Request) {
	display(w, "main", &Page{Title: "Home"})
}

func aboutHandler(w http.ResponseWriter, r *http.Request) {
	display(w, "about", &Page{Title: "About"})
}

func main() {
	http.HandleFunc("/", mainHandler)
	http.HandleFunc("/about", aboutHandler)

	//Listen on port 8080
	http.ListenAndServe(":9300", nil)
}



